//
//  LBWComposeButton.swift
//  weibo
//
//  Created by Limonwei on 15/12/12.
//  Copyright © 2015年 heima. All rights reserved.
//

//设置按钮的一些基本属性

import UIKit

class LBWComposeButton: UIButton {

    //将按钮的高亮效果去掉
    override var highlighted: Bool{
        
        set{
            
        }
        get{
           return false
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        //设置内容子控件的一些属性
        titleLabel?.textAlignment = .Center
        titleLabel?.font = UIFont.systemFontOfSize(14)
        setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        
        //指定imageView的contentModel
        imageView?.contentMode = .Center
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        //调整imageView
        imageView?.y = 0
        imageView?.width = width
        imageView?.height = width
        
        //调整titleLabel
        titleLabel?.x = 0
        titleLabel?.y = width
        titleLabel?.width = width
        titleLabel?.height = height - width
    }

}


























